#include <stdio.h>
#include <stdlib.h>

int* circularGameLosers(int n, int k, int* returnSize);

int main(int argc, char *argv[])
{
    int *a;
    int *b = circularGameLosers(1,1, a);

    for (int i = 0; i < *a; i++) {
        printf("%d ", b[i]);
    }

    return 0;
}

int* circularGameLosers(int n, int k, int* returnSize){
    int i = 0, c = 1, l = 0;
    int a[50] = {0};
    for (i=0;a[i]==0;c++){
        a[i] = 1;
        i = (i+c*k)%n;
    }

    l = n-c+1;
    c = l;
    int *res = (int *) malloc(l*sizeof(int));
    for (i = 0; i < n; i++){
        if(a[i]==0){
            res[l-c] = i+1;
            c--;
        }
    }
    *returnSize = l;
    return res;
}